-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[llvm] prepare explicit template instantiations in llvm/DebugInfo for DLL export annotations #140785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…dBuilder::writeMemberType
|
@llvm/pr-subscribers-debuginfo Author: Andrew Rogers (andrurogerz) ChangesPurposeThis patch prepares the llvm/DebugInfo library for public interface annotations in support of an LLVM Windows DLL (shared library) build, tracked in #109483. The purpose of this patch is to make the upcoming codemod of this library more straight-forward. It is not expected to impact any functionality. OverviewAdds declarations to the header files for two explicit specialized methods:
These specializations are already defined the corresponding implementation files:
This patch will not impact functionality, it just ensures they're exposed as part of the public ABI so they can be annotated for export in a subsequent patch. BackgroundThe LLVM Windows DLL effort is tracked in #109483. Additional context is provided in this discourse. ValidationLocal builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:
Full diff: https://github.com/llvm/llvm-project/pull/140785.diff 2 Files Affected:
diff --git a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
index 84cef520a2f46..fc86a6249aa94 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/ContinuationRecordBuilder.h
@@ -12,6 +12,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/CodeView/CVRecord.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
@@ -50,6 +51,19 @@ class ContinuationRecordBuilder {
std::vector<CVType> end(TypeIndex Index);
};
+
+#define TYPE_RECORD(EnumName, EnumVal, Name)
+#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#define MEMBER_RECORD(EnumName, EnumVal, Name) \
+ extern template void ContinuationRecordBuilder::writeMemberType( \
+ Name##Record &Record);
+#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+#undef TYPE_RECORD
+#undef TYPE_RECORD_ALIAS
+#undef MEMBER_RECORD
+#undef MEMBER_RECORD_ALIAS
+
} // namespace codeview
} // namespace llvm
diff --git a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
index fcc0452a6ae9a..2ee815b0e9617 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/SimpleTypeSerializer.h
@@ -10,6 +10,7 @@
#define LLVM_DEBUGINFO_CODEVIEW_SIMPLETYPESERIALIZER_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include <vector>
namespace llvm {
@@ -32,6 +33,18 @@ class SimpleTypeSerializer {
ArrayRef<uint8_t> serialize(const FieldListRecord &Record) = delete;
};
+#define TYPE_RECORD(EnumName, EnumVal, Name) \
+ extern template ArrayRef<uint8_t> SimpleTypeSerializer::serialize( \
+ Name##Record &Record);
+#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#define MEMBER_RECORD(EnumName, EnumVal, Name)
+#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
+#undef TYPE_RECORD
+#undef TYPE_RECORD_ALIAS
+#undef MEMBER_RECORD
+#undef MEMBER_RECORD_ALIAS
+
} // end namespace codeview
} // end namespace llvm
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The templates were previously defined, but not necessarily meant for external consumption. Are we sure that these are meant to be exported? I guess the question is, why do these templates have to be exposed? Are users expected to call these low level methods or is it because they are referenced from other symbols?
Yeah, good question. They are only referenced by the unit tests for this library (DebugInfoCodeViewTests). It wasn't needed for Windows DLL, just for so/dylib builds with hidden visibility. But I think I actually have a simpler solution that doesn't require these declarations in the header. |
|
Ok, there is a way to solve this one without adding these exports. Closing this out. |
Purpose
This patch prepares the llvm/DebugInfo library for public interface annotations in support of an LLVM Windows DLL (shared library) build, tracked in #109483. The purpose of this patch is to make the upcoming codemod of this library more straight-forward. It is not expected to impact any functionality.
Overview
Adds declarations to the header files for two explicit specialized methods:
ContinuationRecordBuilder::writeMemberTypeSimpleTypeSerializer::serializeThese specializations are already defined the corresponding implementation files:
llvm/lib/DebugInfo/CodeView/ContinuationRecordBuilder.cppllvm/lib/DebugInfo/CodeView/SimpleTypeSerializer.cppThis patch will not impact functionality, it just ensures they're exposed as part of the public ABI so they can be annotated for export in a subsequent patch.
Background
The LLVM Windows DLL effort is tracked in #109483. Additional context is provided in this discourse.
Validation
Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: